home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_100 / 122_01 / defs < prev    next >
Text File  |  1984-03-05  |  3KB  |  80 lines

  1. DEFINITIONAL OPERATORS:
  2. copyright (C) 1983 by E. E. Bergmann
  3. definitions in alphabetical (ASCII) order
  4. :
  5. ::
  6. *********************************************************
  7. *                            *
  8. * PISTOL-Portably Implemented Stack Oriented Language    *
  9. *            Version 2.0            *
  10. * (C) 1983 by    Ernest E. Bergmann            *
  11. *        Physics, Building #16            *
  12. *        Lehigh Univerisity            *
  13. *        Bethlehem, Pa. 18015            *
  14. *                            *
  15. * Permission is hereby granted for all reproduction and *
  16. * distribution of this material provided this notice is *
  17. * included.                        *
  18. *                            *
  19. *********************************************************
  20. :
  21. ::
  22. ARRAY        NUM 'NAME -->
  23.         Creates an array whose name was placed on the
  24.         the top of stack. The size of the array (in
  25.         words) is established from the NUM that was on
  26.         stack.  Subsequent invocation of NAME will
  27.         place a pointer to NAME[0] on top of stack.
  28.         For example, to print the value of NAME[17]:
  29.         X> NAME 17 W* + ?
  30.  
  31. BRANCH        Creates a new "catagory" or "heading" for
  32.         definitions; creates a new vocabulary whose
  33.         name is what has been placed on the stack.
  34.         For example:
  35.         X> 'SPECIAL< BRANCH
  36.         X> SPECIAL<  DEFINITIONS
  37.         X> 'FIRST : ....    ;
  38.         .
  39.         .
  40.         X> > DEFINITIONS  % finish definitions for
  41.         X>          % SPECIAL< vocabulary
  42.  
  43. CONSTANT    defines a word whose name is on the top    of
  44.         stack and assigns it the permanent value given
  45.         by the next to top.
  46.  
  47. VARIABLE    Allocates space in RAM and defines a word whose
  48.         name is on top of stack.  Later, when the name
  49.         is invoked, a pointer to the allocated space is
  50.         pushed on stack.  The variable is initialized
  51.         to the next to top of stack.
  52.  
  53.  :  ... ;    is used in creating a standard definition.
  54.         It takes the string pointed to by the top of
  55.                 stack as the name of the word being defined.
  56.                 The body of the word is anything that is placed
  57.                 between the ":" and the ";". When the
  58.                 definition extends beyond one line of text,
  59.                 thesystem displays a prompt that contains a
  60.                 ":".  Examples have been provided already in
  61.                 the tutorial.
  62.  
  63. $: ... ;$    is used to create a "macro" definition.  In
  64.                 syntax and use its behavior is very similar to
  65.                 a standard definition, as described immediately
  66.                 above.  However the code that is associated
  67.                 with the newly defined word will be compiled
  68.                 "in line" when the word is invoked, instead of
  69.                 being called.  Its use increases the execution
  70.                 speed of any code that uses the word (since the
  71.                 is no overhead from a "call"), but the
  72.                 resulting code is usually longer; thus we can
  73.                 choose our own preference between speed and
  74.                 memory space.  It is used to define "perfect
  75.                 NOPs", such as in the definition of W* when the
  76.                 word size is, in fact, 1. (see the beginning of
  77.                 PBASE).
  78. :
  79. s a prompt that contains a
  80.